package com.yaowk.web.mall.clothing.controller;

import com.yaowk.api.mall.clothing.model.Commission;
import com.yaowk.api.mall.clothing.service.ICommissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/mall/clothing/commission")
@Api(tags = "佣金控制器")
public class CommissionController {

    @Autowired
    private ICommissionService commissionService;

    @GetMapping
    @ApiOperation("佣金列表")
    public List<Commission> list() {
        List<Commission> list = commissionService.findAll();
        return list;
    }

    @PostMapping
    @ApiOperation("保存佣金")
    public void save(Commission commission) {
        commissionService.save(commission);
    }

    @DeleteMapping("/{id}")
    @ApiOperation("删除佣金")
    public void delete(@PathVariable Integer id) {
        commissionService.deleteById(id);
    }

}
